package co.yixiang.modules.mp.entity.domain;

import co.yixiang.common.domain.BaseDomain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@TableName("yx_article_visit_log")
public class YxArticleVisitLog extends BaseDomain {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    /**
     * 文章点赞id
     */
    private Integer id;

    /**
     * 文章id
     */
    private Integer articleId;

    /**
     * 用户id
     */
    private String uid;

    /**
     * 文章标题
     */
    private String title;

    /**
     * 文章作者
     */
    private String author;

    /**
     * 原文链接
     */
    private String url;

    /**
     * 浏览次数
     */
    private Integer visit;

    /**
     * 单次最大时长
     */
    private Integer maxTime;

    /**
     * 总时长
     */
    private Integer totalTime;

    /**
     * 点赞状态
     */
    private Boolean likeStatus;

    public YxArticleVisitLog(YxArticle article, String uid) {
        this.author = article.getAuthor();
        this.articleId = article.getId();
        this.title = article.getTitle();
        this.url = article.getUrl();
        this.uid = uid;
        this.visit = 0;
        this.likeStatus = Boolean.FALSE;
        this.maxTime = 0;
        this.totalTime = 0;
    }
}
